package com.xiguanlezz.cn;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Author：习惯了种种
 * @CreateDate：2024/11/4 19:46
 * @Description：
 */
public class ThreadPoolUtils {
    private static final ThreadPoolExecutor EXECUTOR;

    static {
        EXECUTOR = new ThreadPoolExecutor(10, 10, 600L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(65536));
    }

    public static void submit(Runnable task) {
        EXECUTOR.submit(task);
    }

    public static void shutdown() {
        if (EXECUTOR.isShutdown()) {
            return;
        }
        EXECUTOR.shutdown();
    }

}
